<?php
ini_set('display_errors', 'on');
ini_set('date.timezone','Asia/Shanghai');
use Workerman\Worker;

require_once 'vendor/autoload.php';

// 标记是全局启动
define('GLOBAL_START', 1);
!defined('ROOT') && define('ROOT', __DIR__);
foreach(glob(__DIR__.'/Applications/*') as $dir)
{
    if(in_array(substr($dir, strrpos($dir, '/') + 1), ['Statistics','common'])) continue;
    require __DIR__.'/Applications/common/index.php';
}
// 加载所有Applications/*/start.php，以便启动所有服务
foreach(glob(__DIR__.'/Applications/Statistics/start*.php') as $start_file)
{
    require_once $start_file;
}
Worker::$logFile = __DIR__ . '/cache/workerman.log';
Worker::$pidFile = __DIR__ . '/cache/workerman.pid';
// 运行所有服务
Worker::runAll();